package com.winhxd.b2c.customer.dao;

import com.winhxd.b2c.common.domain.customer.condition.*;
import com.winhxd.b2c.common.domain.customer.model.CustomerUserInfo;
import com.winhxd.b2c.common.domain.customer.vo.*;
import com.winhxd.b2c.common.domain.system.login.condition.CustomerUserInfoCondition;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CustomerUserInfoMapper {
    int deleteByPrimaryKey(Long id);

    int insert(CustomerUserInfo record);

    int insertSelective(CustomerUserInfo record);

    int updateByPrimaryKeySelective(CustomerUserInfo record);

    int updateByPrimaryKey(CustomerUserInfo record);
    /**
     * @param ids 用户ids
     * @return 用户信息
     * @author chengyy
     * @date 2018/8/6 15:39
     * @Description 根据用户id批量查询用户信息
     */
    List<CustomerUserInfoVO> selectCustomerUserByIds(@Param("ids") List<Long> ids);

    /**
     * @param ids 用户ids
     * @return 用户信息
     * @author chengyy
     * @date 2018/8/6 15:39
     * @Description 根据用户id批量查询用户信息 返回所属店铺名称
     */
    List<CustomerUserInfoVO> selectCustomerUserStoreByIds(@Param("ids") List<Long> ids);

    /**
     * @param condition 查询条件
     * @return 统计结果
     * @author lishaoping
     * @date 2019年1月7日14:39:06
     * @Description 运营首页统计
     */
    Integer countTodayNewUser(CustomerOperationHomePageCondition condition);

    /**
     * @param
     * @return condition
     * @author wangzekun
     * @date 2019/1/8
     * @Description 根据手机号查询用户信息
     */
    CustomerUserInfo selectCustomerUserInfoByCondition(CustomerUserInfoCondition condition);

    /**
     * @param
     * @return condition
     * @author wangzekun
     * @date 2019/1/8
     * @Description 根据手机号查询用户信息
     */
    CustomerUserInfo selectCustomerUserInfoByPhone(@Param("phone") String phone);

    /**
     * @param
     * @return condition
     * @author wangzekun
     * @date 2019/1/8
     * @Description 查询分销商下面的所有会员
     */
    List<CustomerUserInfoVO> selectDistributorMemberList(DistributorQueryCondition condition);

    /**
     * @param
     * @return condition
     * @author wangzekun
     * @date 2019/1/8
     * @Description 根据parentId批量修改会员渠道
     */
    Integer updateUserLevelChannelByParentID(CustomerDistributorCondition condition);


    /**
     * 查询分销商列表信息
     * @param condition
     * @return
     */
    List<CustomerDistributorVO> selectCustomerUserInfoListByCondition(CustomerDistributorCondition condition);

    /**
     * 根据主键查询分销商换绑所需要的简单信息
     * @param id
     * @return
     */
    CustomerDistributorSimpleVO selectSimpleCustomerUserListById(@Param("id") Long id);

    /**
     * 根据主键查询分销商详情信息
     * @param id
     * @return
     */
    CustomerDetailVO selectDetailCustomerUserListById(@Param("id") Long id);


    /**
     * @param
     * @return condition
     * @author wangzekun
     * @date 2019/1/8
     * @Description 修改会员状态
     */
    Integer updateUserStatusByID(CustomerDistributorCondition condition);


    /**
     * @param id
     * @return condition
     * @author wangzekun
     * @date 2019/1/9
     * 根据主键查询分销商信息
     */
    CustomerUserInfo selectByPrimaryKey(Long id);


    Integer updateCustomerParentIdByIds(CustomerParentIdCondition condition);


    Integer selectCustomerTodayTotal(CustomerTotalCondition condition);

    /**
     * 查询用户门店列表
     * @param condition
     * @return
     */
    List<CustomerStoreVO> findCustomerStoreList(CustomerStoreInfoCondition condition);


    /**
     * @param
     * @return parentId
     * @author wangzekun
     * @date 2019/1/12
     * @Description 查询分销商下面的会员数量
     */
    Integer countMemberCountByParentId(@Param("parentId") Long parentId);



    List<CustomerUserInfoVO> selectDistributorListByChannelIdAndLevel(CustomerDistributorCondition condition);



    int countCheckMobileNumber(@Param("id") Long id, @Param("mobile") String mobile);


    int countDistributorSecondByParentId(@Param("parentId") Long parentId);


    int updateMemberDistributorBind(CustomerUserInfo record);


    void updateCodeUrl(@Param("id") Long id);
}